
-define(NOT_REGISTERED, 0).
-define(REGISTER_IN_PROGRESS, 1).
-define(REGISTERED, 2).
-define(CALL_IN_PROGRESS, 3).

-define(USER_AGENT, "erl-b2bua - Erlang B2BUA").
-define(EXPIRES, 1800).
-define(MEDIA_LIST, [111, 110]).

-define(T1, 500).
-define(T2, 4000).

-record(sip_session_state, {b2bua_session_pid, userid, password, socket, mapped_address = -1, ua_state, cseq, dialog_table, transaction_table, ti_pid = -1, stun_timer = -1, 
                            media_session_pid = -1, b2bua_media_listener_pid = -1, deregister_timer = -1, confirm_timer = -1, parse_record}).
-record(dialog, {call_id, method, route, remote_target, local_cseq, remote_cseq, local_tag, remote_tag, local_uri, remote_uri}).
-record(transaction, {branch_id, method, cseq, call_id, transaction_record}).
-record(retransmit, {method, request, secs, timer, dest_server, dest_port, transport_type}).

-record(parse_record, {ip, port, type, status, via = [], route = [], received_ip, rport, branch_id, from, from_tag, to, to_tag = "", cseq, method, call_id, 
                       content_length, realm, nonce, opaque, stale, qop, contact=[], sdp}). 
-record(contact_record, {contact, expires = 0}).

-record(transaction_record, {expires, auth_count, realm, nonce, nonce_count = 0, to}).
-record(media_session_state, {sip_session_pid, rtp_socket, rtcp_socket, rtp_port, rtcp_port, peer_ip, peer_rtp_port, peer_rtcp_port, media}).
-record(sdp, {peer_ip, peer_port, media}).
